home *** CD-ROM | disk | FTP | other *** search
- :Batutil c(o) 1991 Barry Simon and Richard Wilson
- : Version 4.0
- echo off
- cls
- batutil {inc %0 code}
- goto end
- :code
- RC $
- {AT 02}{CU -}{CL}{RO 5}{CO 5}
- echoln This demo shows the language capabilities of BATUTIL, new in version 4.
- echoln $S First we'll show a multiplication table made with a
- echoln $S nested BATUTIL for loop, string manipulation and arithmetic
- echoln
- GE WA3 EL
- AT 0E
- for $1=1 to 10 begin
- CO 15
- for $2=1 to 10 echo $s(F,$V($1*$2),R,4)
- echoln
- end
- GE WA5 EL
- AT 1E
- CL
- $2=3
- echo $_$_Enter a number between 40 and 200$_$S$S$S
- goto firsttry
- ;code to handle incorrect entry starts here; given 3 choices
- la tryagain
- CL
- if $2=0 then begin
- echo $_$_OK; we'll take the number to be 100 then!$_$_
- $1=100
- go gotpast
- end
- echo $_$_Sorry; I want a number between 40 and 200$_$S$S$S
- so 2
- la firsttry
- $1=$N
- --$2
- isnum $1 40 200
- if $r>0 then go tryagain
- la gotpast
- $2=$V($J+$1)
- echoln The date $1 days from now will be $E($2).
- GE WA4 EL
- echo $_$_ Notice that BATUTIL can accept numeric input, test its range
- echo $_ and do date arithmetic.$_
- echo $_ BATUTIL's for command allows both incremental numbers and
- echo $_ lists/filenames as with DOS batch command. Fordir will read
- echo $_ all directories on a disk and let you manipulate them.
- echo $_ Here, we'll just list their names...this may take a moment.
- GE WA2 EL
- fordir $2 in (\) do echoln $2
- GE WA3 EL
- {AT 0F} CL {RO 5}
- echoln Please enter a sentence. Do NOT use the character $$.
- $2=$Q
- $1=$s(W,$2,0)
- if $1 > 2 then $3=$s(W,$2,3) else $3=you$Shad$Sfewer$Sthan$Sthree$Swords
- echo $_$_ Your sentence had $1 words. The third word was "$3".$_
- GE WA5 EL
- :end
-